home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 12454 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.4 KB

  1. Path: news.spies.com!usenet
  2. From: Erik Max Francis <max@alcyone.com>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: beginner question
  5. Date: Sun, 31 Mar 1996 19:49:46 -0800
  6. Organization: Alcyone Systems
  7. Message-ID: <315F525A.4A1CD496@alcyone.com>
  8. References: <4jc3sr$1ggu@uvaix3e1.comp.UVic.CA> <4jdo7l$de2@sparcserver.lrz-muenchen.de> <315AFED2.7466@willows.com>
  9. NNTP-Posting-Host: newton.alcyone.com
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 2.01 (X11; I; Linux 1.2.13 i486)
  14.  
  15. Tarang Deshpande wrote:
  16.  
  17. > So then what does the following mean:
  18. > struct _FOO
  19. > {
  20. >         int     bar;
  21. > } FOO;
  22. > struct _FOO s1;
  23. > FOO         s2;
  24. > Why?
  25.  
  26. This is a compiler error.
  27.  
  28.     struct _FOO { int bar; } FOO;
  29.  
  30. declares a structure called struct _FOO and an instance of that structure FOO.
  31. The further declaration
  32.  
  33.     FOO s2;
  34.  
  35. and is tantamount to saying
  36.  
  37.     int x, y;
  38.     x y;
  39.  
  40. What you're probably _actually_ seeing is
  41.  
  42.     typedef struct _FOO { int bar; } FOO;
  43.  
  44. which defines the type FOO which is an alias for struct _FOO.
  45.  
  46. -- 
  47. Erik Max Francis &tSftDotIotE && http://www.alcyone.com/max && max@alcyone.com
  48. San Jose, California, U.S.A. && 37 20 07 N 121 53 38 W && the 4th R is respect
  49. H.3`S,3,P,3$S,#$Q,C`Q,3,P,3$S,#$Q,3`Q,3,P,C$Q,#(Q.#`-"C`- && 1love && folasade
  50. Omnia quia sunt, lumina sunt. && Dominion, GIGO, GOOGOL, Omega, Psi, Strategem
  51. "Out from his breast/his soul went to seek/the doom of the just." -- _Beowulf_
  52.